package client.gui;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.DateFormat;
import java.util.ArrayList;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.ScrollPaneConstants;

import client.CheckinClient;
import client.Fclient;
import client.Service;

public class FlightInfoPanel extends DisplayPanel implements ActionListener, MouseListener {

	private static final long serialVersionUID = 2358366248062823594L;
	private static final int MAX_WIDTH = 0;
	private final JButton Register = new JButton("Check for flight No.....");
	
	
	private final JButton CheckFlight = new JButton("Check time for your flight");
	private final JTextField FlightInfo = new JTextField("Search text here!");
	  private JScrollPane scroll;
	  private final JPanel displayPanel = new JPanel();


	  private JPopupMenu popup ;
	
	
	
	
	public FlightInfoPanel(Service s) {
		super(s);
		this.setLayout(null);
		init();
	}
	private void init(){
		
	
		
		
		add(Register);
		Register.addActionListener(this);
				//Set Bound on Button
		Register.setBounds(35,50,200,20);
		
	
		CheckFlight.addActionListener(this);
		add(CheckFlight);
		
		
		add(FlightInfo);
		FlightInfo.addActionListener(this);
		FlightInfo.setBounds(35,30,300,20);
		  displayPanel.setPreferredSize(new Dimension(750, 5000));
		
		  


        
		
	}
    public void actionPerformed(ActionEvent e) {
    	
    	JTextArea ok = new  JTextArea ("	Origin Flight No. Time Status        ");
        ok.setBounds(50, 150, 400, 100);
 
        add(ok);
    	
    	if(e.getSource()==Register){
    		
		//JLabel temp = new JLabel(((Fclient)myClient).checkFlight((FlightInfo.getText())));
	System.out.println((myClient == null)+" "+ (FlightInfo == null));
		String t=(((Fclient)myClient).checkFlight((FlightInfo.getText())));
		ok.setLineWrap(true);
		JLabel temp = new JLabel(t);
		

		temp.setAutoscrolls(getAutoscrolls());
		System.out.println(t);
		ok.add(temp);
		temp.setBounds(35,30,550,100);
		
		
 

			


			
    	}

    	
    	
    }
    public void mouseClicked(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
    
    
	}

    

